#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/types.h>

void DoThing()
{
  int count = 0;
  while(count < 5)
  {
    printf("pid: %d, ppid: %d, count: %d\n", getpid(), getppid(), count);
    count++;
    sleep(1);
  }
}

int main()
{
  pid_t ids[5];
  printf("I am father: %d\n", getpid());
  for(int i = 0; i < 5; i++){
    ids[i] = fork();
    if(ids[i] == 0){
      //child
      DoThing();
      exit(1);
    }
  }
  return 0;
}
//int main()
//{
//  while(1)
//  {
//    printf("I am a process!, my pid is %u\n", getpid());
//    sleep(1);
//  }
//}
